package cn.bdqn.biz_consumer.controller;


import cn.bdqn.biz_consumer.service.SolrService;
import cn.bdqn.common.Dto;
import cn.bdqn.common.DtoUtil;
import cn.bdqn.pojo.Doctor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/solr")
public class SolrController {

    @Resource
    private SolrService solrService;

    @RequestMapping(value = "/getlist",method = RequestMethod.GET)
    public Dto getList(@RequestBody Doctor doctor){
        List<Doctor> doctors=new ArrayList<>();
        try {
            doctors= solrService.getDocList(doctor);
            return DtoUtil.returnDataSuccess(doctors);
        } catch (Exception e) {
            e.printStackTrace();
            return DtoUtil.returnFail("异常","1212121");
        }

    }


}